<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>lesson 33</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>

<body>
    <div id="root"></div>
</body>

</html>

<script>
    // 对数据做校验的插件
    const app = Vue.createApp({
        data() {
            return {
                name: "dell",
                age: 19
            };
        },
        rules: {
            age: {
                validate: (age) => {
                    return age > 25
                },
                message: '太小了'
            }
        },
        template: `
        <div>
            name:{{name}},
            age:{{age}}    
        </div>
        `
    });

    app.mixin({
        created() {
            // console.log('mixin ready');
            console.log(this.$options.rules);
        }
    });

    const vm = app.mount("#root");
</script>